<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<x:parse xml="${param.xmlstr}" var="xmlData"/>
<div class="t_bar"><span class="color_red">*</span>${param.title}</div>
<table class="t_css" id="basic_tab" width="100%" border="0" cellpadding="0"
       cellspacing="1">
    <col style="width: 25%"/>
    <col style="width: 25%"/>
    <col style="width: 25%"/>
    <col style="width: 25%"/>
    <tr class="li_1">
        <td align="right">项目名称：</td>
        <td colspan="3">
            <input type='text' name='proposal/zh_title' id='project_name' style="width: 80%" maxlength="100"
                   class="required" value='<x:out select="$xmlData/data/proposal/zh_title"/>' label="项目名称">
        </td>
    </tr>
    <tr>
        <td align="right">归口管理单位：</td>
        <td>
            <c:set var="recomend_org"> {'id':'<x:out
                    select="$xmlData/data/proposal/recomend_org_value"/>', 'name':'<x:out
                    select="$xmlData/data/proposal/recomend_org_name"/>' } </c:set>
            <cpt:tree id="recomend_org" key="recommended_org" cacheable="false"
                      className="hn_iuput_kuang required selectWidth3" readonly="true" value="${recomend_org}"
                      label="归口管理单位"
                      showPattern="all" shieldPattern="0" onClick="initTreeValue2">
            </cpt:tree>
            <input type="hidden" id="recomend_org_value" name="proposal/recomend_org_value"
                   value="<x:out select="$xmlData/data/proposal/recomend_org_value" />">
            <input type="hidden" name="proposal/recomend_org_name"
                   value="<x:out select="$xmlData/data/proposal/recomend_org_name" />">
        </td>
        <td align="right">申报日期：</td>
        <td>
            <c:set var="submit_date"><x:out select="$xmlData/data/proposal/submit_date"/></c:set>
            <cpt:date id="apply_date_curr" name="proposal/submit_date" value="${submit_date}" className="required date"
                      label="申报日期"></cpt:date>
        </td>
    </tr>
    <tr>
        <td align="right">申报单位名称（全称）：</td>
        <td colspan="3">
            <span name="organizations/organization/org_name">
                <x:out select="$xmlData/data/organizations/organization[@submit_org='1']/org_name"/>
            </span>
        </td>
    </tr>
    <tr>
        <td align="right">法定代表人姓名：</td>
        <td>
            <span name="organization_persons/faren_cname">
                <x:out select="$xmlData/data/organization_persons/person[@type='faren']/cname"/>
            </span>
        </td>
        <td align="right">法定代表人联系电话：</td>
        <td>
            <span name="organization_persons/faren_tel">
                <x:out select="$xmlData/data/organization_persons/person[@type='faren']/tel"/>
            </span>
        </td>
    </tr>
    <tr>
        <td align="right">资源库（圃）负责人姓名：</td>
        <td>
            <span name="proposal/fzr_psnname">
                <x:out select="$xmlData/data/zh_persons/zh_person [@submit_psn='1']/basic_info/zh_name"/>
            </span>
        </td>
        <td align="right">负责人联系电话：</td>
        <td>
            <span name="proposal/fzr_phone">
                <x:out select="$xmlData/data/zh_persons/zh_person [@submit_psn='1']/contact/tel_work"/>
            </span>
        </td>
    </tr>
    <tr>
        <td align="right">手机号码：</td>
        <td>
            <span name="proposal/fzr_mobil">
                <x:out select="$xmlData/data/zh_persons/zh_person [@submit_psn='1']/contact/mobile"/>
            </span>
        </td>
        <td align="right">电子邮箱：</td>
        <td>
            <span name="proposal/fzr_email">
                <x:out select="$xmlData/data/zh_persons/zh_person [@submit_psn='1']/contact/email"/>
            </span>
        </td>
    </tr>
    <tr>
        <td align="right">项目申请金额（万元）：</td>
        <td colspan="3">
            <input type='text' name='proposal/request_amt' class="required" id='request_amt'
                   onfocus="InitInput.setNumber(this,9,2,2)" style="text-align: right;"
                   value='<x:out select="$xmlData/data/proposal/request_amt"/>' label="项目申请金额">
        </td>
    </tr>
    <tr>
        <td align="right">单位类型：</td>
        <td colspan="5">
            <span><input type="checkbox" name="unit_type" id="centerColleges" value="中央驻皖高校" onClick="initControlValue(this.id);">中央驻皖高校</span>
            <span style="margin-left: 60px;"><input type="checkbox" name="unit_type" id="provinceColleges" value="省属高校" onClick="initControlValue(this.id);">省属高校</span>
            <span style="margin-left: 60px;"><input type="checkbox" name="unit_type" id="centerResearchInstitutes" value="中央驻皖科研院所" onClick="initControlValue(this.id);">中央驻皖科研院所</span>
            <span style="margin-left: 60px;"><input type="checkbox" name="unit_type" id="provinceResearchInstitutes" value="省属科研院所" onClick="initControlValue(this.id);">省属科研院所<br/></span>
            <span><input type="checkbox" name="unit_type" id="enterprise" value="企业" onClick="initControlValue(this.id);removeDisabled();">企业</span>
            （<input type="checkbox" name="enterprise_type" id="EnterpriseScale" value="国有企业" disabled="disabled" onClick="initControlValue(this.id);">国有企业</span>
            <input type="checkbox" name="enterprise_type" id="privateEnterprise" value="民营企业" style="margin-left: 10px;" disabled="disabled" onClick="initControlValue(this.id);">民营企业
            <input type="checkbox" name="enterprise_type" id="rulesEnterprise" value="规上企业" style="margin-left: 10px;" disabled="disabled" onClick="initControlValue(this.id);">规上企业
            <input type="checkbox" name="enterprise_type" id="middleSmallEnterprise" value="中小企业" style="margin-left: 10px;" disabled="disabled" onClick="initControlValue(this.id);">中小企业
            <input type="checkbox" name="enterprise_type" id="technologyEnterprise" value="科技型中小企业" style="margin-left: 10px;" disabled="disabled" onClick="initControlValue(this.id);">科技型中小企业
            <input type="checkbox" name="enterprise_type" id="highTechEnterprise" value="高新技术企业" style="margin-left: 10px;" disabled="disabled" onClick="initControlValue(this.id);">高新技术企业）
            <span style="margin-left: 20px;"><input type="checkbox" name="unit_type" id="unitTypeOther" value="其他" onClick="initControlValue(this.id);">其他</span>
            <input type="hidden" id="unit_type_value" name="proposal/unit_type_value" class="required" value="<x:out select="$xmlData/data/proposal/unit_type_value" />" label="单位类型">
            <input type="hidden" id="enterprise_type_value" name="proposal/enterprise_type_value" value="<x:out select="$xmlData/data/proposal/enterprise_type_value" />">
        </td>
    </tr>
    <tr class="li_1">
        <td align="right"> 资源库（圃）全称：</td>
        <td colspan="3">
            <input type='text' name='proposal/resource_name' maxlength="100" style="width: 80%" class="required"
                   value='<x:out select="$xmlData/data/proposal/resource_name"/>' label="资源库（圃）全称">
        </td>
    </tr>
    <tr>
        <td align="right">建设开始时间：</td>
        <td colspan="3">
            <c:set var="begbuild_date"><x:out select="$xmlData/data/proposal/begbuild_date"/></c:set>
            <cpt:date id="begbuild_date" name="proposal/begbuild_date" value="${begbuild_date}"
                      className="required date beforeToday" label="建设开始时间"></cpt:date>
        </td>
    </tr>
    <tr>
        <td align="right">建设地点：</td>
        <td colspan="3">
            <input type='text' name='proposal/build_area' class=required" maxlength="100" style="width: 80%" label="建设地点"
                   value="<x:out select="$xmlData/data/proposal/build_area" />"/>
        </td>
    </tr>
</table>
<script type="text/javascript">

    function initTreeValueExt(treeId, treeNode) {
        if ((treeNode && treeNode.isParent)) {
            scmWarn("请选择具体的" + $("#" + treeId).attr("label"));
            $("#" + treeId).val("");
            $("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val("");
            $("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val("");
            $("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val("");
            return false;
        }
        var str = treeNode.name;
        var obj = treeNode.parentNode;
        while (obj != null) {
            str = obj.name + "-" + str;
            obj = obj.parentNode;
        }

        $("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val(treeNode.id);
        $("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val(treeNode.id);
        $("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val(str);
    }

    /***
     * 初始化企业选择框是否为可选
     */
    $(document).ready(function () {
        if ($('#enterprise').val() == "企业" && $("#enterprise").prop("checked")) {
            $("#EnterpriseScale").removeAttr("disabled");
            $("#privateEnterprise").removeAttr("disabled");
            $("#rulesEnterprise").removeAttr("disabled");
            $("#middleSmallEnterprise").removeAttr("disabled");
            $("#technologyEnterprise").removeAttr("disabled");
            $("#highTechEnterprise").removeAttr("disabled");
        } else {
            $("#EnterpriseScale").attr("disabled", true);
            $("#privateEnterprise").attr("disabled", true);
            $("#rulesEnterprise").attr("disabled", true);
            $("#middleSmallEnterprise").attr("disabled", true);
            $("#technologyEnterprise").attr("disabled", true);
            $("#highTechEnterprise").attr("disabled", true);
        }
    });

    /**
     * @Description
     * @Author Alm
     * @Date 2019/10/11 16:41
     * @Version V1.0
     * 勾选型企业框时打开后面的选项框
     * 没有勾选时关闭后面的选择框，并清除隐藏域的值
     */
    function removeDisabled() {
        if ($('#enterprise').val() == "企业" && $("#enterprise").prop("checked")) {
            $("#EnterpriseScale").removeAttr("disabled");
            $("#privateEnterprise").removeAttr("disabled");
            $("#rulesEnterprise").removeAttr("disabled");
            $("#middleSmallEnterprise").removeAttr("disabled");
            $("#technologyEnterprise").removeAttr("disabled");
            $("#highTechEnterprise").removeAttr("disabled");
        } else {
            $("#enterprise_type_value").val("");
            $("#EnterpriseScale").removeAttr("checked");
            $("#privateEnterprise").removeAttr("checked");
            $("#rulesEnterprise").removeAttr("checked");
            $("#middleSmallEnterprise").removeAttr("checked");
            $("#technologyEnterprise").removeAttr("checked");
            $("#highTechEnterprise").removeAttr("checked");
            $("#EnterpriseScale").attr("disabled", true);
            $("#privateEnterprise").attr("disabled", true);
            $("#rulesEnterprise").attr("disabled", true);
            $("#middleSmallEnterprise").attr("disabled", true);
            $("#technologyEnterprise").attr("disabled", true);
            $("#highTechEnterprise").attr("disabled", true);
        }
    }

</script>	